import os,shutil
import function

dir1="D:/Desk/0312-炳哥尺寸转换/尺寸删除"
files=function.get_all_names(dir1)
dir2="D:/Desk/0312-炳哥尺寸转换/result"
results=function.get_all_names(dir2)
print(results)

list_done=[]
for k in results:
    if not os.path.exists(os.path.join(dir2,'size')):
        os.makedirs(os.path.join(dir2,'size'))
    if not os.path.exists(os.path.join(dir2,'pattern')):
        os.makedirs(os.path.join(dir2,'pattern'))
    path_old=os.path.join(dir2,k)
    if '_bottom' in k:
        shutil.move(path_old,os.path.join(dir2,'size',k))
    if '_remaining' in k:
        shutil.move(path_old,os.path.join(dir2,'pattern',k))
    k=k.replace('_bottom','').replace('_remaining','')
    if k not in list_done:
        list_done.append(k)

for file in files:
    if not os.path.exists(os.path.join(dir1,'完成')):
        os.makedirs(os.path.join(dir1,'完成'))
    if not os.path.exists(os.path.join(dir1,'未完成')):
        os.makedirs(os.path.join(dir1,'未完成'))
    path_old=os.path.join(dir1,file)
    if file in list_done:
        shutil.move(path_old,os.path.join(dir1,'完成',file))
    else:
        shutil.move(path_old,os.path.join(dir1,'未完成',file))
        
        
